package com.robusta.spreadsheet.describe.jaxb;

import com.robusta.spreadsheet.describe.TemplateInfo;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
public class Template implements TemplateInfo {
    @XmlElement(namespace = "http://www.robusta-inc.com/describe-workbook")
    private int sheetIndex;
    @XmlElement(namespace = "http://www.robusta-inc.com/describe-workbook")
    private int headerRowIndex;
    @XmlElement(namespace = "http://www.robusta-inc.com/describe-workbook")
    private int startColumnIndex;

    public int getHeaderRowIndex() {
        return headerRowIndex;
    }

    public int getSheetIndex() {
        return sheetIndex;
    }

    public int getStartColumnIndex() {
        return startColumnIndex;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Template template = (Template) o;

        if (headerRowIndex != template.headerRowIndex) return false;
        if (sheetIndex != template.sheetIndex) return false;
        if (startColumnIndex != template.startColumnIndex) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = sheetIndex;
        result = 31 * result + headerRowIndex;
        result = 31 * result + startColumnIndex;
        return result;
    }
}
